package rpc.conf;

import org.apache.commons.lang3.StringUtils;

public class WebConfig {

  private int port;
  private String basePath;
  private boolean autoWeb = false;

  public int getPort() {
    return port;
  }

  public WebConfig setPort(int port) {
    this.port = port;
    return this;
  }

  public boolean isAutoWeb() {
    return autoWeb;
  }

  public WebConfig setAutoWeb(boolean autoWeb) {
    this.autoWeb = autoWeb;
    return this;
  }

  public String getBasePath() {
    return StringUtils.firstNonEmpty(basePath, "");
  }

  public WebConfig setBasePath(String basePath) {
    this.basePath = basePath;
    return this;
  }

  @Override
  public String toString() {
    return "WebConfig{" +
        "port=" + port +
        ", basePath='" + basePath + '\'' +
        ", autoWeb=" + autoWeb +
        '}';
  }
}
